//
//  HitInfo.hpp
//  RayTracer
//
//  Created by 俞云康 on 2/15/16.
//  Copyright © 2016 yushroom. All rights reserved.
//

#ifndef HitInfo_hpp
#define HitInfo_hpp

#include "Math.hpp"
#include "Ray.hpp"
#include "Color.hpp"
#include <memory>

class Material;
class Shape;
class GeometricPrimitive;

struct DifferentialGeometry {
    Position position;
    Normal normal;
    float2 uv;
    const Shape* shape_ptr;
    //const Primitive* primitive;
    Direction dpdu, dpdv;
    //Normal dndu, dndv;
    //mutable Direction dpdx, dpdy;
    //mutable float dudx, dvdx, dudy, dvdy;
};

struct HitInfo {
    Ray ray;
    float3 position;
    float3 normal;
    float3 in_dir;
    float2 texcoord = {0, 0};
    Direction dpdu, dpdv;
    std::shared_ptr<Material> material = nullptr;
    //const Shape* shape_ptr = nullptr;
    const GeometricPrimitive* primitive;

	Color Le(const Direction &w) const;
};

#endif /* HitInfo_hpp */
